#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <iostream>   
#include <numeric>   
#include <algorithm>   
#include <fcntl.h>

using namespace std;


#define SPORT   8084



#define STR_WELCOME "Welcome to seChat! You ID is: Client #%d"
#define STR_MESSAGE "Client #%d>> %s"
#define STR_NOONE_CONNECTED "Noone connected to server except you!"
#define CMD_EXIT "EXIT"

//两个有用的宏定义：检查和赋值并且检测
#define CHK(eval) if(eval < 0){perror("eval"); exit(-1);}
#define CHK2(res, eval) if((res = eval) < 0){perror("eval"); exit(-1);}

#define ERR_EXIT(m) \
    do { \
        perror(m);\
        exit(-1);\
    }while(0)



//包数据结构 : [ 包头 + 长度(8字节)+fin  + 包类型(2字节)+to+from+ 数据[] + 包尾 ]
#define NET_PACKET_START                "PACKET_START"
#define NET_PACKET_END                  "PACKET_END"
#define NET_PACKET_TYPE_BYTES           2    //包类型占几个字节
#define NET_PACKET_LTNGTH_BYTES         8    //包数据长度占几个字节
#define NET_PACKET_UID_BYTES            16    //包数据长度占几个字节
#define NET_PACKET_FIN_BYTES            1    //包数据长度占几个字节

#define NET_PACKET_DATA_SIZE   3072 
#define NET_PACKET_SIZE (sizeof(NetPacketHeader) + NET_PACKET_DATA_SIZE) * 10

//待传输图像默认大小为 640*480，可修改
#define IMG_WIDTH 640   // 需传输图像的宽
#define IMG_HEIGHT 480  // 需传输图像的高
//默认格式为CV_8UC3
#define BUFFER_SIZE     IMG_WIDTH*IMG_HEIGHT*3/32

#define FILE_SIZE     2048


//////////////////////////////////////////////////////////////////////////
